﻿<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="${req.contextPath}/css/common.css">
   <link rel="stylesheet" href="${req.contextPath}/css/main.css">
   <script type="text/javascript" src="${req.contextPath}/js/jquery.min.js"></script>
   <script type="text/javascript" src="${req.contextPath}/js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="${req.contextPath}/js/common.js"></script>


</head>
<body>
        <form id="headFrom" method="post">
     <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">会议室预定管理</b></div>
            <div class="box_center pt10 pb10">
              <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
<#--                  <td>预定时间段</td>-->
<#--					<td>-->
<#--						<#if endTime! == "">-->
<#--							<input type="date" id="startTime" name="startTime" min  max class="input-text lh25" size="10">to-->
<#--							<input type="date" id="endTime" name="endTime" min  max class="input-text lh25" size="10">(预定时间段必须为同一天)-->
<#--						<#else >-->
<#--							<input type="date" id="startTime" name="startTime" min  max value="${startTime}" class="input-text lh25" size="10">to-->
<#--							<input type="date" id="endTime" name="endTime" min  max value="${endTime}" class="input-text lh25" size="10">(预定时间段必须为同一天)-->
<#--						</#if>-->
<#--					</td>-->
                 
                  <td>预定人</td>
                  <td>
					  <#if realNameT??>
					  <input class="input-text lh25" type="text" id="realName" name="realName" value="${realNameT}">
					  <#else >
						  <input class="input-text lh25" type="text" id="realName" name="realName">
					  </#if>
				  </td>
				  <td>会议室名称</td>
                  <td>
					  <#if meetIdT??>
						  <select class="input-text lh25" id="meetId" name="meetId">
							  <#list meeting as meet>
							   <option
                                    <#if meet.meetId==meetIdT> selected</#if>
									   value="${meet.meetId}">
								   ${meet.meetName}
                                </option>
							  </#list>
						  </select>
					  <#else >
						  <select class="input-text lh25" id="meetId" name="meetId">
							  <option value="">--请选择--</option>
							  <#list meeting as meet>
								  <option value="${meet.meetId}">${meet.meetName}</option>
							  </#list>
						  </select>
					  </#if>
				  </td>

				  <td>会议类型</td>
                  <td>
					  <#if meetTypeIdT??>
						  <select class="input-text lh25" id="meetTypeId" name="meetTypeId">
							  <#list typeList as type>
								  <option
										  <#if type.typeId==meetTypeIdT> selected</#if>
										  value="${type.typeId}">
									  ${type.typeName}
								  </option>
							  </#list>
						  </select>
					  <#else >
						  <select class="input-text lh25" id="meetTypeId" name="meetTypeId">
							  <option value="">-请选择-</option>
							  <#list typeList as type>
								  <option value="${type.typeId}">${type.typeName}</option>
							  </#list>
						  </select>
					</#if>
				  </td>
                   <td>
					<input type="button" onclick="sel(1)" class="btn btn82 btn_search" value="查询">
			    	<input type="button" onclick="formReset()"  class="btn btn82 btn_recycle" value="清空"></td>
                </tr>
               
              </table>
            </div>

			</div>
	   </div>
			</form>
			
		
 <div id="table" class="mt10">
        <div class="box span10 oh">
			<#if infoNull??  >

			<h1 class="text-center" style="color: #0088cc">无数据</h1>

			<#else >
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
				   <th> <input type="checkbox" id="checkall" onclick="checkAll()"></th>
                   <th >会议室名称</th>
                   <th >会议室起始时间</th>
				   <th >会议室结束时间</th>
				   <th >会议室用途</th>
				   <th >批准人</th>
				   <th >预定人</th>
				   <th>预定时间</th>
                    </tr>

					  <#list pageInfo.list as info>
						  <tr class="tr" align="center">
							  <td class="td_center" name='id'>
								  <input type="checkbox" name='id' value="${info.id}" onclick="docheck()" />
							  </td>
							  <td>
								  <#list meeting as meet>
									  <#if meet.meetId == info.meetId>
										  ${meet.meetName}
									  </#if>
								  </#list>
							  </td>
							  <td>
								  ${info.startTime?string('yyyy-MM-dd HH:mm:ss')}
							  </td>
							  <td>${info.endTime?string('yyyy-MM-dd HH:mm:ss')}</td>
							  <td>
								  <#list typeList as type>
									  <#if type.typeId == info.meetTypeId>
										  ${type.typeName}
									  </#if>
								  </#list>
							  </td>
							  <td>
								  <#list users as users>
									  <#if users.classsifyId == info.userId>
										  ${users.realName}
									  </#if>
								  </#list>
							  </td>
							  <td>${info.realName}</td>
							  <td>${info.applyTime?string('yyyy-MM-dd HH:mm:ss')}</td>
						  </tr>
					  </#list>
               <tr>
			   <td colspan="2">
			    <input type="button" name="button"  class="btn btn82 btn_export" value="导出" onclick="excel()">
				<input type="button" name="button" class="btn btn82 btn_res"  value="返回" onclick="location.href='javascript:history.go(-1)'">
				</td>
				<td colspan="5" align="right">
				     <div class="page mt10">
						<div class="pagination">
							<ul >

									<li class="first-child"><a href="javascript:;" onclick="sel(1)">首页</a></li>
									<#if pageInfo.getPrePage() lt 1>
										<li>
											<a href="javascript:;" onclick="sel(1)">上一页</a>
										</li>
									<#else >
										<li>
											<a href="javascript:;" onclick="sel(${pageInfo.getPrePage()})">上一页</a>
										</li>
									</#if>

									<#if pageInfo.getNextPage() == 0>
										<li>
											<a href="javascript:;" onclick="sel(${pageInfo.getPages()})">下一页</a>
										</li>
									<#else >
										<li>
											<a href="javascript:;" onclick="sel(${pageInfo.getNextPage()})">下一页</a>
										</li>
									</#if>
									<li > <a href="javascript:;" onclick="sel(${pageInfo.getPages()})">末页</a></li>
									<li ><span>共${pageInfo.total}条数据</span></li>
									<li ><span>共${pageInfo.getPages()}页</span></li>

							</ul>
						</div>
                     </div>
				</td>
			   </tr>
              </table>
			</#if>
             
        </div>
     </div>
<script type="text/javascript" src="${req.contextPath}/js/jquery.min.js"></script>
<script>


	var checkall, item;
	checkall = document.getElementById("checkall");
	item = document.getElementsByName("id");
	//全选框判断：全选 全不选
	function checkAll() {
		for (var i = 0; i <item.length; i++) {
			if(checkall.checked){
				item[i].checked = true;
			}else{
				item[i].checked = false;
			}
		}
	}
	//单选框判断:如果单选框被选中的数量和单选框的数量相等的时候全选框选中，反之没有被选中；
	function docheck(){
		var count=0;
		for (var i = 0; i <item.length ; i++) {
			if(item[i].checked){
				count++;
			}
		}
		if(count===item.length){
			checkall.checked = true;
		}else{
			checkall.checked = false;
		}
	}

	//导出
	function excel() {
		var chk_value =[];//定义一个数组
		$('input[name="id"]:checked').each(function(){//遍历每一个名字为id的复选框，其中选中的执行函数
			chk_value.push($(this).val());//将选中的值添加到数组chk_value中
		});
		if (chk_value.length==0){
			alert("请先选择要导出的数据");
			return;
		}
		location.href="${req.contextPath}/administrative/excelReserveMeet?ids="+chk_value;
	};

//qingkong
	function formReset() {
		// document.getElementById("headFrom").reset();
		$(":input","#headFrom").not(':button, :submit, :reset, :hidden,:radio') // 去除不需要重置的input类型
		       .val('')
				.removeAttr('checked')
				.removeAttr('selected');
	}

	//条件查询
	function sel(page) {

		var realName=$("#realName").val();

		var meetId=$("#meetId").val();
		var meetTypeId=$("#meetTypeId").val();


		location.href="${req.contextPath}/administrative/ReserveMeetLogLike?page="+page+
				"&realName="+realName+"&meetId="+meetId+"&meetTypeId="+meetTypeId;



	}


</script>
</body>
</html>